/*
 * Copyright (C) 2012-2013 Michael L.R. Marques
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * Contact: michaellrmarques@gmail.com
 */
package com.jm.jmsql.sql.predictions.events;

import com.jm.jmsql.objects.base.JMSqlObject;
import java.util.List;

/**
 *
 * @author Michael L.R. Marques
 */
public class PredictionEvent {
    
    //
    private List<JMSqlObject> predictionList;
    //
    private int index;
    //
    private boolean predictionSelected;
    
    /**
     * 
     */
    public PredictionEvent() {
        this(null);
    }
    
    /**
     * 
     * @param predictionList 
     */
    public PredictionEvent(List<JMSqlObject> predictionList) {
        this(predictionList, -1);
    }
    
    /**
     * 
     * @param predictionList
     * @param index 
     */
    public PredictionEvent(List<JMSqlObject> predictionList, int index) {
        this.predictionList = predictionList;
        this.index = index;
        this.predictionSelected = predictionList != null && index >= 0;
    }
    
    /**
     * 
     * @return 
     */
    public JMSqlObject getPrediction() {
        if (!this.predictionSelected) {
            return null;
        }
        return this.predictionList.get(index);
    }
    
    /**
     * 
     * @return 
     */
    public List<JMSqlObject> getPredictionList() {
        return this.predictionList;
    }
    
    /**
     * 
     * @return 
     */
    public int getPredictionIndex() {
        if (!this.predictionSelected) {
            return -1;
        }
        return this.index;
    }
    
    /**
     * 
     * @return 
     */
    public boolean isPredictionSelected() {
        return this.predictionSelected;
    }
    
}
